package engine.parsers.impl;

import engine.content.IContent;
import engine.parsers.IParser;
import engine.services.IContentService;

public class GoComicsParser implements IParser {


	// returns the url for the picture after parsing the original url
	public IContent parse(IContent urlContent, IContentService contentService) throws Exception {
		String urlContentStr = urlContent.getContent().toString();
		String searchStr = "<p class=\"feature_item";
		int startSearch = urlContentStr.indexOf(searchStr);
		int startLink = urlContentStr.indexOf("src=\"", startSearch)+5;
		int endLink = urlContentStr.indexOf("\"", startLink);
		String imgStr = urlContentStr.substring(startLink, endLink);

		return contentService.getResponse(imgStr);
	}
}
